#ifndef CONSOLE_H
#define CONSOLE_H
#define COLOR_SELF COLOR_GREEN
#define COLOR_ALLY COLOR_YELLOW
#define COLOR_ENEMY COLOR_RED
#define COLOR_NEUTRAL COLOR_WHITE
#define BG_NORMAL COLOR_BLACK

//TODO: different backgrounds support
#define PAIR_SELF 1
#define PAIR_ALLY 2
#define PAIR_ENEMY 3
#define PAIR_NEUTRAL 4

//GAME: normální pohled a jediný, kterým se zatím budeme zabývat
#define VIEW_TYPE_GAME 1
#define VIEW_TYPE_MAP 2
#define VIEW_TYPE_CHAT 3
#define VIEW_TYPE_MESS 4
class TScreen;

class TView {
 public:
  long int offset_x, offset_y;
  int width, height;
  int type;
  void blit();
  void pan(int diff_x, int diff_y);
  void draw(TUnit * unit);
  void draw(TBuilding * building);
  void operator<< (TUnit& unit);
  void operator<< (TBuilding& building);
  TScreen* Screen;
  TView();
  ~TView();
};

class TMenuItem {
	bool enabled;
	enum type {CLICK, CHECK, TEXT, NUMBER};
	string text;
/* TActionList on_select();
 TActionList on_activate();*/
	TMenuItem();
	~TMenuItem();
};

class TMenu {
	string title;
	list <TMenuItems> items;
	enum type{SELECT, MULTI_SELECT, INTERACTIVE};
	TMenu();
	~TMenu();
};

class TMsgBox {
	string title;
	enum type {CONFIRM, ASK, ERROR};
};

class TStatusBar {
	string text;
	int timeout;
};

class TKeyboard {
 public:
  TKeyboard();
  void operator>>(std::string& target);
 private:
};

class TScreen {
 public:
  void draw_unit(TUnit* unit);
  void draw_char(int x, int y, char type, int pair_id);
  void draw_building(TBuilding* building);
  void draw_menu(int x, int y, TMenuItems* items);
  void blit();
  TScreen();
  TScreen(int width, int height);
  TKeyboard keyboard;
  TView* view;
 private:
  void blit(int x, int y, int width, int height);
  void print(int x, int y, std::string text);
  bool use_colors;
};
#endif
